package umt.cs.cs241.Assignment1.r_1_10;

/*
 * Chris Hanshew
 * CS 241 Assignment 1
 * 9/9/08
 * R 1.10
 */

public class Driver_1_10 {
	
	public static void main(String[] args) {
		
		int n = 7;
		
		System.out.println(sumOfN(n));
	}
	
	/**
	 * Determines the sum of all numbers beneath a given int value.
	 * 
	 * @param n An int value.
	 * @return sum A sum of all the numbers beneath n.
	 */
	public static int sumOfN(int n){
		
		int sum = 0;
		
		//Loop until n = 0 and add the value of n to sum.
		while(n != 0){
			n--;
			sum += n;
		}
		
		return sum;
	}
}
